* This do-file runs the regressions that replicate and extend part of Colantone and Stanig (2018)

* Log file	

log using "replication_colantone_stanig_logfile.log", replace

* Import data

use "./replication_colantone_stanig_2018.dta", clear


* First define the regression sample from regression with longer equation

xtmixed leave import_shock immig_cultural age gender i.nuts1code i.education [pweight=wt_full_W8] ||nuts3: 

cap drop in_broken

gen in_broken=e(sample)

*** Regression of vote for Leave on China shock, as in column 1 of Table 1

xtmixed leave import_shock age gender i.nuts1code i.education [pweight=wt_full_W8] if in_broken==1 ||nuts3:

*** Regression of vote for Leave on China shock controlling for immigration stances, as in column 2 of Table 1

xtmixed leave import_shock immig_cultural age gender i.nuts1code i.education [pweight=wt_full_W8] ||nuts3:


*** Regression of immigration stances on China, as in column 1 of Table 2

xtmixed immig_cultural import_shock age gender i.nuts1code i.education if in_broken==1 ||nuts3:


* close log file

log close